home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / grafica / amhelios / ff_poly.h < prev    next >
C/C++ Source or Header  |  1999-01-01  |  2KB  |  81 lines

  1. ////////////////////////////////////////////////////////////
  2. //
  3. //  FF_POLY.H - Form Factor Polygon Class
  4. //
  5. //  Version:    1.03A
  6. //
  7. //  History:    94/08/23 - Version 1.00A release.
  8. //              94/12/16 - Version 1.01A release.
  9. //              95/02/05 - Version 1.02A release.
  10. //              95/07/21 - Version 1.02B release.
  11. //              96/02/14 - Version 1.02C release.
  12. //              96/04/01 - Version 1.03A release.
  13. //
  14. //  Compilers:  Microsoft Visual C/C++ Professional V1.5
  15. //              Borland C++ Version 4.5
  16. //
  17. //  Author:     Ian Ashdown, P.Eng.
  18. //              byHeart Software Limited
  19. //              620 Ballantree Road
  20. //              West Vancouver, B.C.
  21. //              Canada V7S 1W3
  22. //              Tel. (604) 922-6148
  23. //              Fax. (604) 987-7621
  24. //
  25. //  Copyright 1994-1996 byHeart Software Limited
  26. //
  27. //  The following source code has been derived from:
  28. //
  29. //    Ashdown, I. 1994. Radiosity: A Programmer's
  30. //    Perspective. New York, NY: John Wiley & Sons.
  31. //
  32. //  It may be freely copied, redistributed, and/or modified
  33. //  for personal use ONLY, as long as the copyright notice
  34. //  is included with all source code files.
  35. //
  36. ////////////////////////////////////////////////////////////
  37.  
  38. #ifndef _FF_POLY_H
  39. #define _FF_POLY_H
  40.  
  41. #include "patch3.h"
  42. #include "vector4.h"
  43.  
  44. // Maximum number of output vertices
  45. static const int MaxVert = 10;
  46.  
  47. class FormPoly          // Form factor polygon
  48. {
  49.   private:
  50.     Point3 posn[MaxVert];       // Output vertex array
  51.     int num_vert;               // Number of vertices
  52.     WORD ident;                 // Polygon identifier
  53.  
  54.     void AddVertex( Vector4 &v )
  55.     { v.Perspective(&(posn[num_vert++])); }
  56.  
  57.     void Reset( WORD id )
  58.     {
  59.       num_vert = 0;
  60.       ident = id;
  61.     }
  62.  
  63.     friend class FormClipEdge;
  64.     friend class FormClip;
  65.  
  66.   public:
  67.     FormPoly()
  68.     {
  69.       num_vert = 0;
  70.       ident = 0;
  71.     }
  72.  
  73.     int GetNumVert() { return num_vert; }
  74.     Point3 &GetVertex( int i )
  75.     { return posn[i]; }
  76.     WORD GetPolyId() { return ident; }
  77. };
  78.  
  79. #endif
  80.  
  81.